package lex.netant;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;

public class About extends JDialog {
	JLabel label;
	JPanel panel;
	JTextArea ta;
	JScrollPane sp;
	String s1, s2;
	JButton button;
	Container contentPane;

	public About(JFrame parent) {
		super(parent, "About...");
		init();
	}

	public void init() {
		s1 = "javaants 1.0";
		s2 = "          Welcome to use javaants1.0!";
		contentPane = getContentPane();
		button = new JButton("OK");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		label = new JLabel(s1);
		panel = new JPanel();
		panel.add(label);
		ta = new JTextArea(10, 8);
		ta.setEditable(false);
		ta.setText(s2);
		sp = new JScrollPane(ta);
		contentPane.add(panel, BorderLayout.NORTH);
		contentPane.add(sp, BorderLayout.CENTER);
		contentPane.add(button, BorderLayout.SOUTH);
	}

	public void center() {
		Dimension screenSize, size;
		screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		size = this.getSize();
		if (size.height > screenSize.height) {
			size.height = screenSize.height;
		}
		if (size.width > screenSize.width) {
			size.width = screenSize.width;
		}
		this.setLocation((screenSize.width - size.width) / 2, (screenSize.height - size.height) / 2);
	}

}